<%--
  Created by IntelliJ IDEA.
  User: lichengming
  Date: 2017/8/17
  Time: 下午3:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/resources.jsp" %>

<html>
<head>
    <title>Title</title>
    <style type="text/css">
        .detail_label {
            font-weight: bold;
        }
        .detail_image img {
            width: 100%;
        }
    </style>
</head>
<body>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">用户申请审核</h3>
        </div>
        <div class="panel-body">
            <div class="panel panel-default">
                <div class="panel-body">
                    <h4>申请资料</h4>
                    <div class="well" style="width: 100%">
                        <p><label class="detail_label">昵称：</label>${record.user.nick_name}</p>

                        <p><label class="detail_label">申请时间：</label>${record.apply_time}</p>

                        <p><label class="detail_label">状态：</label>${record.user.status_str}</p>

                        <p><label class="detail_label">身份证正面照：</label>
                        </p>
                        <p class="detail_image">
                            <img src="${record.front_image}" />
                        </p>

                        <p><label class="detail_label">身份证反面照：</label></p>
                        <p class="detail_image">
                            <img src="${record.backend_image}" />
                        </p>

                    </div>

                    <c:if test="${record.apply_result == 0}" >
                        <div class="well">
                            <button type="button" id="audit_succeed" class="btn btn-success">审核通过</button>
                            <button type="button" id="audit_fail" class="btn btn-danger">审核不通过</button>
                        </div>
                    </c:if>
                </div>
            </div>
        </div>
</div>
<script>

    $("#audit_succeed").on("click",function () {

        $.emsAjax({
            url:"/ems/userauth/auditUpdate",
            data:{status:1,id:'${record.id}'},
            type:"POST",
            success:function (resp) {
                if (resp.status == "000") {
                    $.toast(resp.message,function () {
                        window.location.href = "/ems/userauth/index"
                    });
                }else {
                    $.toast(resp.message,"cancel");
                }
            }
        })
    });

    $("#audit_fail").on("click",function () {
        $.emsAjax({
            url:"/ems/userauth/auditUpdate",
            data:{status:2,id:'${record.id}'},
            type:"POST",
            success:function (resp) {
                if (resp.status == "000") {
                    $.toast(resp.message,function () {
                        window.location.href = "/ems/userauth/index"
                    });
                }else {
                    $.toast(resp.message,"cancel");
                }
            }
        })
    });
</script>
</body>
</html>
